﻿using Dsl.Ped.Controls.ProjectiveControl.Helpers;
using NUnit.Framework;

namespace DSLPedControlsTest.ProjectiveControl.Helpers
{
    [TestFixture]
    public class EventHelperTest
    {
        [SetUp]
        public void SetUp()
        {
            
        }

        #region GetOwnerTypeName

        [Test, RequiresSTA]
        public void GetOwnerTypeNameTest1()
        {
            var fullEventName = "System.Windows.Controls.Button.Click";
            var ownerType = EventHelper.GetOwnerTypeName(fullEventName);

            Assert.AreEqual("System.Windows.Controls.Button", ownerType);
        }

        [Test, RequiresSTA]
        public void GetOwnerTypeNameTest2()
        {
            var fullEventName = "Click";
            var ownerType = EventHelper.GetOwnerTypeName(fullEventName);

            Assert.AreEqual(string.Empty, ownerType);
        }

        [Test, RequiresSTA]
        public void GetOwnerTypeNameTest3()
        {
            var fullEventName = "Button.Click";
            var ownerType = EventHelper.GetOwnerTypeName(fullEventName);

            Assert.AreEqual("Button", ownerType);
        }

        [Test, RequiresSTA]
        public void GetOwnerTypeNameTest4()
        {
            string fullEventName = null;
            var ownerType = EventHelper.GetOwnerTypeName(fullEventName);

            Assert.AreEqual(string.Empty, ownerType);
        }

        [Test, RequiresSTA]
        public void GetOwnerTypeNameTest5()
        {
            string fullEventName = string.Empty;
            var ownerType = EventHelper.GetOwnerTypeName(fullEventName);

            Assert.AreEqual(string.Empty, ownerType);
        }

        #endregion

        #region GetEventName

        [Test, RequiresSTA]
        public void GetEventNameTest1()
        {
            var fullEventName = "System.Windows.Controls.Button.Click";
            var eventName = EventHelper.GetEventName(fullEventName);

            Assert.AreEqual("Click", eventName);
        }

        [Test, RequiresSTA]
        public void GetEventNameTest2()
        {
            var fullEventName = "Click";
            var eventName = EventHelper.GetEventName(fullEventName);

            Assert.AreEqual("Click", eventName);
        }

        [Test, RequiresSTA]
        public void GetEventNameTest3()
        {
            var fullEventName = "Button.Click";
            var eventName = EventHelper.GetEventName(fullEventName);

            Assert.AreEqual("Click", eventName);
        }

        [Test, RequiresSTA]
        public void GetEventNameTest4()
        {
            string fullEventName = null;
            var eventName = EventHelper.GetEventName(fullEventName);

            Assert.AreEqual(string.Empty, eventName);
        }

        [Test, RequiresSTA]
        public void GetEventNameTest5()
        {
            var fullEventName = string.Empty;
            var eventName = EventHelper.GetEventName(fullEventName);

            Assert.AreEqual(string.Empty, eventName);
        }

        #endregion
    }
}
